﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Alma.Models;
using AlmaDatabase;

namespace Alma.Controllers
{
    public class HomeController : Controller
    {

        public ActionResult Index()
        {
            Session["PrevProduct"] = null;
            using (var context = new AlmaDBEntities())
            {
                var model = new HomeModel();
                model.Categories = new List<HomeCategory>();
                foreach (var r in context.Categories)
                {
                    model.Categories.Add(new HomeCategory()
                        { 
                            Id = r.ID, 
                            ImageName = r.ImageName,
                            Name = r.Name
                        });
                }
                
                return View(model);
            }
        }

    }
}
